<?php


/**
 * Greendizer sales grid cell renderer
 *
 * @author      Youssef El Bied <youssef@greendizer.com>
 */
class Greendizer_Module_Block_Renderer extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Action
{
    public function render(Varien_Object $row)
    {
        $params = array('id' => $row->getId());
        if ($secretKey = $this->getRequest()->getParam(Mage_Adminhtml_Model_Url::SECRET_KEY_PARAM_NAME))
        {
            $params[Mage_Adminhtml_Model_Url::SECRET_KEY_PARAM_NAME] = $secretKey;
        }
        return parent::render($row).'&nbsp;&nbsp;&nbsp;'.($row->isSentToGreendizer() ? sprintf('<a href="%s" target="_blank"><img src="http://www.greendizer.com/favicon.png" width="16" height="16"/></a>', Mage::getUrl('greendizer/invoice/index', $params)) : '');
    }
}
